Identify the variable type
def what_type(g):
x = str(type(g))
if "int" in x:
return "int"
elif "str" in x:
return "str"
elif "bool" in x:
return "bool"
Function Call | Return Value | |||
---|---|---|---|---|
what_type("cat") | → | |||
what_type(True) | → | |||
what_type(7) | → |
Experiment with this code on Gitpod.io